package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class Factor implements Term {

    private int beginIndex;
    private int endIndex;
    private Sign sign;
    private NumericPrimary numericPrimary;

    public Factor(Sign sign, NumericPrimary numericPrimary) {
        this.beginIndex = sign != null ? sign.getBeginIndex() : numericPrimary.getBeginIndex();
        this.endIndex = numericPrimary.getEndIndex();
        this.sign = sign;
        this.numericPrimary = numericPrimary;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public Sign getSign() {
        return sign;
    }

    public NumericPrimary getNumericPrimary() {
        return numericPrimary;
    }

}
